<template>
	<view class="pt-redemption">
		<scroll-view scroll-x class="pt-redemption-box" v-if="list.length">
			<view class="pt-redemption-item" v-for="(data,index) in list" :key='index' @click="goProInfo(data.goods_id,data.goods_type)">
				<view class="image"><image :src="data.image" mode="aspectFit"></image></view>
				<view class="name">{{data.goods_name}}</view>
				<view class="price"  v-if="isLogin">
					<text class="retail-price"><text>￥</text>{{data.retail_price}}</text>
					<text class="market-price"><text>￥</text>{{data.market_price?data.market_price:0}}</text>
				</view>
				<view class="noLogin" v-else>登录查看会员价</view>
			</view>
		</scroll-view>
		<pt-nothing :text="'暂无'+name+'商品'" bgColor="#FFF" style="margin-top: -30rpx;" v-else></pt-nothing>
	</view>
</template>

<script>
	export default {
		props: {
			isLogin: {
				type: Boolean,
				default: false
			},
			name: {
				type: String,
				default: ''
			},
			list: {
				type: Array,
				default(){
					return []
				}
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			goProInfo(goods_id,goods_type){
				this.$emit('GoInfoAddFoot')
				switch (goods_type){
					case 1:
						getApp().goProInfo(goods_id)
						break;
				}
			}
		}
	}
</script>

<style lang="scss">
	.pt-redemption{
		padding: 0 30rpx 30rpx;
		.pt-redemption-box{
			white-space: nowrap;
			.pt-redemption-item{
				display: inline-block;
				vertical-align: top;
				width: 210rpx;
				margin-right: 30rpx;
				&:last-child{
					margin-right: 0;
				}
				.image{
					image{
						width: 210rpx;
						height: 210rpx;
						border-radius: 8rpx;
						border: solid 2rpx #f7f7f7;
					}
				}
				.name{
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 24rpx;
					color: #28221F;
					margin: 20rpx 0;
				}
				.price{
					.retail-price{
						color: #F59359;
						font-size: 28rpx;
						font-weight: bold;
						text{
							font-size: 22rpx;
							font-weight: normal;
						}
					}
					.market-price{
						color: #909090;
						font-size: 22rpx;
						text-decoration: line-through;
						margin-left: 10rpx;
					}
				}
				.noLogin{
					display: inline-block;
					background-color: #F59359;
					color: #FFF;
					border-radius: 10rpx;
					padding: 6rpx 12rpx;
					font-size: 20rpx;
				}
			}
		}
	}
</style>